package cn.whale.pay.domain;

import com.baomidou.mybatisplus.enums.IdType;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author whale.chen
 * @since 2020-12-12
 */
@Data
@TableName("t_pay_flow")
@AllArgsConstructor
public class PayFlow extends Model<PayFlow> {

    //支付类型，购买课程
    public static final int TYPE_BUY_COURSE_ORDER = 1;

    //0.支付中，1.支付成功，3.支付失败
    public static final Integer STATUS_APPLY = 0;
    public static final Integer STATUS_PAY_SUCCESS = 1;
    public static final Integer STATUS_PAY_ERROR = 1;

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @TableField("create_time")
    private Date createTime;
    private String intro;
    private BigDecimal amount;
    /**
     * 支付类型
     */
    private Integer type;

    @TableField("pay_status")
    private Integer payStatus;

    private Integer version = 0;

    @TableField("result_desc")
    private String resultDesc;
    /**
     * 业务ID
     */
    @TableField("relation_id")
    private Long relationId;
    /**
     * 支付编号，比如订单号
     */
    @TableField("pay_no")
    private String payNo;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public PayFlow(){}
    public PayFlow(String intro,BigDecimal amount,Integer type,Integer payStatus,String resultDesc,Long relationId,String payNo){
        this.createTime = new Date();
        this.intro = intro;
        this.amount = amount;
        this.type = type;
        this.payStatus = payStatus;
        this.resultDesc = resultDesc ;
        this.relationId = relationId ;
        this.payNo = payNo;
    }
}
